/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

/**
 *
 * @author do.ob
 */
    public class Palabra{

    private String termino;
    private Integer tf; //Frecuencia del termino en tal documento
    private Integer cantDoc;
    private Integer id;
    private Integer maxTf;

    public Palabra(String termino) {
        this.termino = termino;
        tf = 1;
    }

    public Palabra(Integer id, String termino, Integer cantDoc, Integer maxTf) {
        this.termino = termino;
        this.maxTf = maxTf;
        this.cantDoc = cantDoc;
        this.id = id;
    }

    public String getTermino() {
        return termino;
    }

    public void setTermino(String termino) {
        this.termino = termino;
    }

    public Integer getTf() {
        return tf;
    }
    public void addTf(){
        tf++;
        System.out.println("la palabra " + termino + " tiene ahora un tf " + tf);
    }

    public void setTf(Integer tf) {
        this.tf = tf;
    }

    public Integer getCantDoc() {
        return cantDoc;
    }

    public void setCantDoc(Integer cantDoc) {
        this.cantDoc = cantDoc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getMaxTf() {
        return maxTf;
    }

    public void setMaxTf(Integer maxTf) {
        this.maxTf = maxTf;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null ||
                obj.getClass().getCanonicalName().compareToIgnoreCase("Palabra") != 0) {
            return false;
        }
        
        return this.termino.compareTo(((Palabra)obj).getTermino()) == 0;
    }

    @Override
    public int hashCode() {
        return termino.hashCode();
    }

    @Override
    public String toString(){
        return this.getTermino();
    }

    
}
